import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [{
        path: '/',
        redirect: '/login'
    },
    {
        path: '/index',
        component: () =>
            import ( /* webpackChunkName: "about" */ '../App.vue'),
        children: [{
                path: '/index',
                redirect: '/index/home'
            }, {
                path: '/index/home',
                component: () =>
                    import ('../views/Home.vue')
            },
            {
                path: '/index/add',
                component: () =>
                    import ('../views/Add.vue')
            },
            {
                path: '/index/edit',
                component: () =>
                    import ('../views/Edit.vue')
            }
        ]

    }, {
        path: '/login',
        component: () =>
            import ('../views/Login.vue')
    },
    {
        path: '/regisity',
        component: () =>
            import ('../views/Regisity.vue')
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router